package webSocket.init;


import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpResponseEncoder;
import webSocket.handler.WebSocketMsgHandler;
import webSocket.handler.WebSocketRegHandler;

public class WebsocketChannelInitializer extends ChannelInitializer<Channel>{
	
	
	@Override
	protected void initChannel(Channel ch) throws Exception {
		ch.pipeline().addLast(new HttpRequestDecoder());
		ch.pipeline().addLast(new HttpObjectAggregator(65536));
		ch.pipeline().addLast(new HttpResponseEncoder());
		ch.pipeline().addLast(new WebSocketRegHandler());
		ch.pipeline().addLast(new WebSocketMsgHandler());
	}

}
